home *** CD-ROM | disk | FTP | other *** search
- Path: news.magicnet.net!usenet
- From: gamecox@magicnet.net (Jody Hagins)
- Newsgroups: comp.lang.c++
- Subject: Re: Pointer to members
- Date: Fri, 16 Feb 1996 09:17:21 GMT
- Organization: MagicNet, Inc.
- Message-ID: <4g17fj$rhf@comet.magicnet.net>
- References: <4fqg56$cfl@gina.zfn.uni-bremen.de>
- NNTP-Posting-Host: pm5-10.magicnet.net
- X-Newsreader: Forte Free Agent 1.0.82
-
- j03k@alf.zfn.uni-bremen.de (Holger Burde) wrote:
-
- >Hi,
-
- >I am writing a drawing Application with C++ and the Motif Toolkit.
- >I saw that the 'right' way to use Classmembers as callbackproc's is
- >to declare them static (static members have ordinary Functions Pointers).
-
- >Is this the only way ?????
-
- >Is there any way to get normal member fuctions accepted (cast from
- >member function to Functions Pointer without compiler feature ...) ??
-
-
- >I tried some (stupid?) casting but nothing worked (not accepted or
- >crashed when called ...(:- ).
-
- >thanx in advance
-
- >hb
-
-
- The reason you need static functions is that a non-static C++ member
- expects a pointer to the object as the first parameter to the
- function. There may be room in implementations to allow this pointer
- be some other parameter than the first, but I've not seen it.
-
- I've used several different ways to implement callbacks such as this
- with C++. Probably the most useful was to use a callback class.
-
- If you want more specific info, on callback classes, email me at
- wjh@ssc.siemens.com or gamecox@magicnet.net
-
- -Jody
-
-
-